PortalUIUtils = {}
local AceGUI = LibStub("AceGUI-3.0")

function PortalUIUtils.CreateInput(label, width, parent)
  local input = AceGUI:Create("EditBox")
  input:SetLabel(label)
  if (width < 1) then
    input:SetRelativeWidth(width)
  else
    input:SetWidth(width)
  end
  parent:AddChild(input)
  return input
end

function PortalUIUtils.CreateTextArea(label, height, parent)
  local textarea = AceGUI:Create("MultiLineEditBox")
  textarea:SetLabel(label)
  textarea:SetFullWidth(true)
  textarea:SetHeight(height)
  parent:AddChild(textarea)
  return textarea
end

function PortalUIUtils.CreateButton(label, width, parent)
  local button = AceGUI:Create("Button")
  button:SetText(label)
  if (width < 1) then
    button:SetRelativeWidth(width)
  else
    button:SetWidth(width)
  end
  parent:AddChild(button)
  return button
end

function PortalUIUtils.CreateDropdown(width, list, parent)
  local dropdown = AceGUI:Create("Dropdown")
  dropdown:SetRelativeWidth(width)
  dropdown:SetLabel("uiMapType")
  dropdown:SetList(list)
  parent:AddChild(dropdown)
  return dropdown
end

function PortalUIUtils.CreateGroup(parent)
  local container = AceGUI:Create("SimpleGroup")
  container:SetFullWidth(true)
  container:SetLayout("Flow")
  parent:AddChild(container)
  return container
end

_G["PortalUIUtils"] = PortalUIUtils